﻿using System;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace TrainingCenterSystem.VocabularyManagement
{
    /// <summary>
    /// Represents a generic word
    /// </summary>
    public class GenericWord
    {
        #region protected members
        protected string _wordId;
        protected string _baseValue;
        protected string _translations;
        protected VocabularyCollection _vocabularyCollection;
        protected string _owningCollectionName;
        protected VocabularyContext _vocabularyContext;
        protected string _owningContextName;
        #endregion

        #region setters and getters
        /// <summary>
        /// Gets or sets the base value of a word.
        /// </summary>
        public string BaseValue
        {
            get { return _baseValue; }
            set { _baseValue = value; }
        }

        /// <summary>
        /// Gets or sets the translations of a word.
        /// </summary>
        public string Translations
        {
            get { return _translations; }
            set { _translations = value; }
        }

        //public VocabularyCollection OwningVocabularyCollection
        //{
        //    get { return _vocabularyCollection; }
        //    set { _vocabularyCollection = value; }
        //}

        //public VocabularyContext VocabularyContext
        //{
        //    get { return _vocabularyContext; }
        //    set { _vocabularyContext = value; }
        //}

        /// <summary>
        /// Gets or sets the collectin name.
        /// </summary>
        public string CollectionName
        {
            get { return _owningCollectionName; }
            set { _owningCollectionName = value; }
        }

        /// <summary>
        /// Gets or sets the context name.
        /// </summary>
        public string ContextName
        {
            get { return _owningContextName; }
            set { _owningContextName = value; }
        }
        #endregion

        #region constructor(s)
        /// <summary>
        /// Creates a generic word.
        /// </summary>
        public GenericWord()
        {
            //_translations = new List<string>();
        }

        /// <summary>
        /// Creates a generic word.
        /// </summary>
        /// <param name="collName">The name of the parent collection.</param>
        /// <param name="contexName">The name of the parent context.</param>
        public GenericWord(string collName, string contextName)
        {
            _owningCollectionName = collName;
            _owningContextName = contextName;
        }
        #endregion 

        #region methods
        /// <summary>
        /// Sets the owning collection
        /// </summary>
        /// <param name="coll">the collection</param>
        public void SetCollection(VocabularyCollection coll)
        {
            _vocabularyCollection = coll;
            _owningCollectionName = _vocabularyCollection.CollectionName;
        }

        /// <summary>
        /// Gets the owning collection
        /// </summary>
        /// <returns>the owning collection</returns>
        public VocabularyCollection GetCollection()
        {
            return _vocabularyCollection;
        }

        /// <summary>
        /// Gets the word id
        /// </summary>
        /// <returns>the word id</returns>
        public string GetWordID()
        {
            return _wordId;
        }

        /// <summary>
        /// Sets the word id
        /// </summary>
        /// <param name="id">the word id</param>
        public void SetWordID(string id)
        {
            _wordId = id;
        }

        /// <summary>
        /// Sets the owning context
        /// </summary>
        /// <param name="cont">the context</param>
        public void SetContext(VocabularyContext cont)
        {
            _vocabularyContext = cont;
            _owningContextName = _vocabularyContext.ContextName;
        }

        /// <summary>
        /// Gets the owning context
        /// </summary>
        /// <param name="cont">the context</param>
        public VocabularyContext GetContext()
        {
            return _vocabularyContext;
        }
        #endregion

    }
}
